package com.springdemo.service;

import com.springdemo.mapper.UserMapper;
import com.springdemo.pojo.Book;
import com.springdemo.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;
    public List<User> findAll(){
        return userMapper.findAll();
    }

    public boolean deleteUser(Integer id) {
        return userMapper.deleteUser(id);
    }

    public List<User> findUserByName(String name) {
        return userMapper.findUserByName(name);
    }

    public List<User> findUserByPhone(String phone) {
        return userMapper.findUserByPhone(phone);
    }

    public List<User> findBookName(String bookName) {
        return userMapper.findBookName(bookName);
    }


    public boolean addUser(User user) {
        return userMapper.addUser(user);
    }

    public boolean updateUser(User user) {
        return userMapper.updateUser(user);
    }

    public boolean addBook(Book book) {
        return userMapper.addBook(book);
    }

    public int findBookNumber(String bookName) {
        return userMapper.findBookNumber(bookName);
    }

    public boolean updateBook(String bookName) {
        return userMapper.updateBook(bookName);
    }
}
